/*
 * Lab07C2.cpp - Example using valgrind
 *
 *  Created on: Mar 25, 2014
 *      Author: Anthony Varghese
 */

#include <iostream>

using std::cin;
using std::cout;
using std::endl;

class A{
public:
    A()     : data(0) {    	cout << "Default constructor for A" << endl;  data = 0;  }
    A(int d): data(d) {    	cout << "Alternate constructor for A: " << d << endl; data = d;    }
    ~A(){    	cout << "Destructor for A: " << data << endl;    }
    A(const A& o){
    	data = o.data;
    	cout << "Copy constructor for A: " << data << endl;
    }
    A& operator =(const A& rhs){
    	cout << "Assignment operator for A: " << rhs.data << endl;
    	return *this;
    }
private:
    int data;
};

int main(){
    cout << "CSIS 237 Lab 7 - Valgrind example" << endl;

    A a(2);
    A acopy(1);
    acopy = a;
    cout << " a is at: " << &a << ", acopy is at " << &acopy << endl;

    A* aheap = new A(a);
    cout << " aheap points to: " << aheap << endl;
    cout << "... done" << endl;
}
